home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-04-14 | 18.0 KB | 789 lines | [TEXT/PJMM] |
- UNIT PalFunStuff;
-
- INTERFACE
-
- USES
- ROM85, ColorQuickDraw, ColorWindowMgr, PaletteMgr, PickerIntf, PalFunGlobals;
-
- FUNCTION ColorQDExists : boolean;
-
- PROCEDURE AnimBall;
- PROCEDURE AnimShape;
- PROCEDURE AnimRainbow;
- PROCEDURE AnimFade;
-
- PROCEDURE MakeRed;
- PROCEDURE MakeGreen;
- PROCEDURE MakeBlue;
- PROCEDURE MakeBall;
- PROCEDURE MakeCur;
- PROCEDURE MakeShape;
- PROCEDURE MakeRainbow;
- PROCEDURE MakeFade;
-
- PROCEDURE DoRedUpdate;
- PROCEDURE DoGreenUpdate;
- PROCEDURE DoBlueUpdate;
- PROCEDURE DoCurUpdate;
- PROCEDURE DoBallUpdate;
- PROCEDURE DoShapeUpdate;
- PROCEDURE DoRainbowUpdate;
- PROCEDURE DoFadeUpdate;
-
- IMPLEMENTATION
-
-
- {******************** General Tools ********************}
-
- {Returns true if the Mac had Color Quickdraw.}
- FUNCTION ColorQDExists; {boolean}
- CONST
- ROM85Loc = $28E;
- TwoHighMask = $C000;
- TYPE
- WordPtr = ^INTEGER;
- VAR
- Wd : WordPtr;
- BEGIN
- Wd := POINTER(ROM85Loc);
- ColorQDExists := (BitAnd(Wd^, TwoHighMask) = 0);
- END;
-
- {Stuffs Red, Green & Blue into RGBColor}
- PROCEDURE SetRGB (VAR RGB : RGBColor;
- R, G, B : INTEGER);
- BEGIN
- RGB.Red := R;
- RGB.Green := G;
- RGB.Blue := B;
- END;
-
- {Copies RGBColor into RGBColor}
- PROCEDURE CopyRGB (RGBsrc : RGBColor;
- VAR RGBdest : RGBColor);
- BEGIN
- RGBdest.Red := RGBsrc.Red;
- RGBdest.Green := RGBsrc.Green;
- RGBdest.Blue := RGBsrc.Blue;
- END;
-
- {Delays a set length time. usually until}
- { the screen in refreshed (prevents ripples)}
- PROCEDURE DoDelay (N : INTEGER);
- VAR
- L : LONGINT;
- BEGIN
- L := TickCount + N;
- WHILE L > TickCount DO
- ;
- END;
-
- {Using 16 Bit Unsigned Integers: C:=A/B}
- PROCEDURE UnSignedDiv (A, B : INTEGER;
- VAR C : INTEGER);
- VAR
- L : LongInt;
- BEGIN
- IF A < 0 THEN
- L := A + 65536
- ELSE
- L := A;
- C := LoWord(L DIV B);
- END;
-
- {Using 16 Bit Unsigned Integers: A:=A+B}
- PROCEDURE UnSignedAdd (VAR A : INTEGER;
- B : INTEGER);
- VAR
- L : LongInt;
- BEGIN
- IF A < 0 THEN
- L := A + 65536 + B
- ELSE
- L := A + B;
- A := LoWord(L);
- END;
-
- {Using 16 Bit Unsigned Integers: A:=A-B}
- PROCEDURE UnSignedSub (VAR A : INTEGER;
- B : INTEGER);
- VAR
- L : LongInt;
- BEGIN
- IF A < 0 THEN
- L := A + 65536 - B
- ELSE
- L := A - B;
- A := integer(LoWord(L));
- END;
-
- {******************** Color Table Tools ********************}
-
- {Given number of Colors to be placed in it, creates a blank CLUT. Gives it}
- { an unique Seed and correct value, but no colors.}
- FUNCTION NewCT (N : integer) : CTabHandle;
- VAR
- MyCT : MyCTabHandle;
- count : integer;
- BEGIN
- MyCT := NIL;
- IF (N > 0) AND (N <= MaxCT) THEN
- BEGIN
- MyCT := POINTER(NewHandle((N * SIZEOF(ColorSpec)) + (2 * SIZEOF(integer)) + SIZEOF(longint)));
- IF MyCT <> NIL THEN
- WITH MyCT^^ DO
- BEGIN
- ctSeed := GetCTSeed;
- ctFlag := 0;
- ctSize := N - 1;
- FOR count := 0 TO N - 1 DO
- WITH ctTable[count] DO
- BEGIN
- value := count;
- SetRGB(rgb, 0, 0, 0);
- END;
- END;
- END;
- NewCT := POINTER(MyCT);
- END;
-
- {Stuffs an RGB value in the Nth Color (numbered 0 to N) of the CLUT.}
- PROCEDURE SetCTEntry (C : CTabHandle;
- N, R, G, B : INTEGER);
- VAR
- MyCT : MyCTabHandle;
- BEGIN
- MyCT := POINTER(C);
- SetRGB(MyCT^^.ctTable[n].rgb, R, G, B);
- END;
-
- {******************** Red ********************}
-
- {Red Window displays encompassing red-shaded circles.}
- {This creates a 3-D Globe effect.}
-
- {Create Red Window/Palette with NewPalette & SetEntryColor commands.}
- PROCEDURE MakeRed;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- S : str255;
- count : integer;
- BEGIN
- SetRect(tempRect, 20, 40, 320, 340);
- GetIndString(S, StrID, 1);
- MyWindow[redW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
-
- MyPalette[redW] := NewPalette(128, NIL, pmTolerant, 0);
- SetRGB(tempRGB, ColorStart, 0, 0);
- FOR count := 0 TO 127 DO
- BEGIN
- SetEntryColor(MyPalette[redW], count, tempRGB);
- UnSignedSub(tempRGB.red, ColorInc);
- END;
-
- SetPalette(MyWindow[redW], MyPalette[redW], true);
- END;
-
- {Draw the Red Window using RGBForeColor.}
- PROCEDURE DoRedUpdate;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- count : integer;
- BEGIN
- SetRect(tempRect, 22, 22, 278, 278);
- SetRGB(tempRGB, ColorStart, 0, 0);
- FOR count := 0 TO 127 DO
- BEGIN
- RGBForeColor(tempRGB);
- PaintOval(tempRect);
- InsetRect(tempRect, 1, 1);
- UnSignedSub(tempRGB.red, ColorInc);
- END;
- END;
-
- {******************** Green ********************}
-
- {Green Window displays a Green Globe.}
-
- {Create Green Window/Palette with NewPalette command & CLUT procedures.}
- PROCEDURE MakeGreen;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- tempCT : CTabHandle;
- Col : INTEGER;
- S : str255;
- count : integer;
- BEGIN
- SetRect(tempRect, 40, 60, 340, 360);
- GetIndString(S, StrID, 2);
- MyWindow[greenW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
-
- tempCT := NewCT(128);
- Col := ColorStart;
- FOR count := 0 TO 127 DO
- BEGIN
- SetCTEntry(tempCT, count, 0, Col, 0);
- UnSignedSub(Col, ColorInc);
- END;
- MyPalette[greenW] := NewPalette(128, tempCT, pmTolerant, 0);
- DisposHandle(Handle(tempCT));
-
- SetPalette(MyWindow[greenW], MyPalette[greenW], true);
- END;
-
- {Draw the Green Window using PmForeColor.}
- PROCEDURE DoGreenUpdate;
- VAR
- tempRect : rect;
- count : integer;
- BEGIN
- SetRect(tempRect, 22, 22, 278, 278);
- FOR count := 0 TO 127 DO
- BEGIN
- PmForeColor(count);
- PaintOval(tempRect);
- InsetRect(tempRect, 1, 1);
- END;
- END;
-
- {******************** Blue ********************}
-
- {Display a Blue Globe (like Green Window), but now the colors }
- {are set up for better displaying (ie. Color Priority).}
-
- {Create Green Window/Palette with NewPalette command & CLUT procedures.}
-
- PROCEDURE MakeBlue;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- tempCT : CTabHandle;
- Col : INTEGER;
- S : str255;
- h, v : integer;
- BEGIN
- SetRect(tempRect, 60, 80, 360, 380);
- GetIndString(S, StrID, 3);
- MyWindow[blueW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
-
- tempCT := NewCT(128);
- Col := ColorStart;
- FOR h := 0 TO 15 DO
- FOR v := 0 TO 7 DO
- BEGIN
- SetCTEntry(tempCT, (v * 16) + h, 0, 0, Col);
- UnSignedSub(Col, ColorInc);
- END;
- MyPalette[blueW] := NewPalette(128, tempCT, pmTolerant, 0);
- DisposHandle(Handle(tempCT));
-
- SetPalette(MyWindow[blueW], MyPalette[blueW], true);
- END;
-
- {Draw the Blue Window using RGBForeColor.}
- PROCEDURE DoBlueUpdate;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- count : integer;
- BEGIN
- SetRect(tempRect, 22, 22, 278, 278);
- SetRGB(tempRGB, 0, 0, ColorStart);
- FOR count := 0 TO 127 DO
- BEGIN
- RGBForeColor(tempRGB);
- PaintOval(tempRect);
- InsetRect(tempRect, 1, 1);
- UnSignedSub(tempRGB.Blue, ColorInc);
- END;
- END;
-
- {******************** Current Color ********************}
-
- {Displays the Current Color Enviroment}
-
- {Create the current Color Window using Explicit colors }
- {(Does not have to set the colors).}
- PROCEDURE MakeCur;
- VAR
- tempRect : rect;
- S : str255;
- BEGIN
- SetRect(tempRect, 100, 80, 420, 400);
- GetIndString(S, StrID, 4);
- MyWindow[curW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
- MyPalette[curW] := NewPalette(256, NIL, pmExplicit, 0);
- SetPalette(MyWindow[curW], MyPalette[curW], true);
- END;
-
- {Draws the current Graphic Device Colors.}
- PROCEDURE DoCurUpdate;
- VAR
- x, y, n : integer;
- tempRect : rect;
- BEGIN
- n := 0;
- FOR y := 0 TO 15 DO
- FOR x := 0 TO 15 DO
- BEGIN
- PmForeColor(n);
- SetRect(tempRect, x * 20, y * 20, (x + 1) * 20, (y + 1) * 20);
- PaintRect(tempRect);
- n := n + 1;
- END;
- END;
-
- {******************** Ball ********************}
-
- {Simple Palette Animation of a Ball Across the Screen}
-
- {Create the Ball Animation Window using Animated colors.}
- PROCEDURE MakeBall;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- S : str255;
- count : integer;
- BEGIN
- SetRect(tempRect, 100, 120, 400, 420);
- GetIndString(S, StrID, 5);
- MyWindow[ballW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
- MyPalette[ballW] := NewPalette(19, NIL, pmAnimated, 0);
-
- SetRGB(tempRGB, $FFFF, $FFFF, $FFFF);
- SetEntryColor(MyPalette[ballW], 0, tempRGB);
- SetRGB(tempRGB, 0, 0, 0);
- SetEntryColor(MyPalette[ballW], 1, tempRGB);
- tempRGB.blue := $FFFF;
- SetEntryColor(MyPalette[ballW], 2, tempRGB);
- tempRGB.blue := 0;
- tempRGB.red := $FFFF;
- FOR count := 3 TO 18 DO
- SetEntryColor(MyPalette[ballW], count, tempRGB);
- SetPalette(MyWindow[ballW], MyPalette[ballW], true);
- END;
-
- {Draw the Balls in the window using PmForeColor.}
- PROCEDURE DoBallUpdate;
- VAR
- R : rect;
- count : integer;
- BEGIN
- SetRect(R, 0, 0, 10000, 10000);
- PmForeColor(18);
- PaintRect(R);
-
- FOR count := 2 TO 17 DO
- BEGIN
- R.top := 16 * count;
- R.left := R.top;
- R.bottom := R.top + 16;
- R.right := R.bottom;
- PmForeColor(count);
- PaintOval(R);
- END;
- END;
-
- {Animate the Ball through the window using AnimateEntry.}
- PROCEDURE AnimBall;
- VAR
- R, B : RGBcolor;
- time, count, temp : integer;
- BEGIN
- SetRGB(R, $FFFF, 0, 0);
-
- SetRGB(B, 0, 0, $FFFF);
-
- FOR time := 1 TO 10 DO
- FOR count := 2 TO 17 DO
- BEGIN
- IF count = 17 THEN
- temp := 2
- ELSE
- temp := count + 1;
- DoDelay(1);
- AnimateEntry(MyWindow[ballW], count, R);
- AnimateEntry(MyWindow[ballW], temp, B);
- END;
- END;
-
- {******************** Shape ********************}
-
- {Given 3 arbitrary regions (Black/White images), calculates how}
- {to draw the window so that the images can be shuffled through}
- {{quickly.}
-
- {Create the Shape Animation Window}
- {('pltt' is automatically loaded in).}
- PROCEDURE MakeShape;
- BEGIN
- MyWindow[shapeW] := GetNewCWindow(ShapeID, NIL, POINTER(-1));
- END;
-
- {Draws Shape. aRgn,bRgn,cRgn are the arbitrary images.}
- PROCEDURE DoShapeUpdate;
- VAR
- aRgn, bRgn, cRgn, TempRgn : RgnHandle;
- count : INTEGER;
- TempRect : Rect;
- PROCEDURE DrawTriag (h, v : INTEGER);
- BEGIN
- MoveTo(h + 25, v);
- Line(-25, 50);
- Line(50, 0);
- Line(-25, -50);
- END;
- BEGIN
- aRgn := NewRgn;
- OpenRgn;
- SetRect(tempRect, 10, 10, 60, 60);
- FrameOval(tempRect);
- SetRect(tempRect, 120, 10, 170, 60);
- FrameRect(tempRect);
- SetRect(tempRect, 120, 80, 170, 130);
- FrameRect(tempRect);
- SetRect(tempRect, 190, 10, 240, 60);
- FrameRect(tempRect);
- SetRect(tempRect, 190, 80, 240, 130);
- FrameRect(tempRect);
- SetRect(tempRect, 10, 80, 110, 81);
- FOR count := 1 TO 25 DO
- BEGIN
- FrameRect(tempRect);
- OffSetRect(tempRect, 0, 2);
- END;
- CloseRgn(aRgn);
- bRgn := NewRgn;
- OpenRgn;
- SetRect(tempRect, 35, 10, 85, 60);
- FrameOval(tempRect);
- SetRect(tempRect, 120, 10, 170, 60);
- FrameOval(tempRect);
- SetRect(tempRect, 120, 80, 170, 130);
- FrameOval(tempRect);
- SetRect(tempRect, 190, 10, 240, 60);
- FrameOval(tempRect);
- SetRect(tempRect, 190, 80, 240, 130);
- FrameOval(tempRect);
- SetRect(tempRect, 10, 80, 11, 130);
- FOR count := 1 TO 25 DO
- BEGIN
- FrameRect(tempRect);
- OffSetRect(tempRect, 4, 0);
- END;
- CloseRgn(bRgn);
- cRgn := NewRgn;
- OpenRgn;
- SetRect(tempRect, 60, 10, 110, 60);
- FrameOval(tempRect);
- DrawTriag(120, 10);
- DrawTriag(120, 80);
- DrawTriag(190, 10);
- DrawTriag(190, 80);
- MoveTo(60, 80);
- Line(50, 25);
- Line(-50, 25);
- Line(-50, -25);
- Line(50, -25);
- CloseRgn(cRgn);
- TempRgn := NewRgn;
-
- {This Region will always be Red (Background)}
- PmForeColor(0);
- SetRect(tempRect, -32000, -32000, 32000, 32000);
- PaintRect(tempRect);
-
- {This region will start Blue, change Red, stay Red}
- PmForeColor(1);
- DiffRgn(aRgn, bRgn, TempRgn);
- DiffRgn(TempRgn, cRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This region will be Red,Blue,Red}
- PmForeColor(2);
- DiffRgn(bRgn, aRgn, TempRgn);
- DiffRgn(TempRgn, cRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This region will be Blue,Blue,Red}
- PmForeColor(3);
- SectRgn(aRgn, bRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This region will be Red,Red,Blue}
- PmForeColor(4);
- DiffRgn(cRgn, aRgn, TempRgn);
- DiffRgn(TempRgn, bRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This region will be Blue,Red,Blue}
- PmForeColor(5);
- SectRgn(aRgn, cRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This region will be Red,Blue,Blue}
- PmForeColor(6);
- SectRgn(bRgn, cRgn, TempRgn);
- PaintRgn(TempRgn);
-
- {This Region will always be Blue}
- PmForeColor(7);
- SectRgn(aRgn, bRgn, TempRgn);
- SectRgn(cRgn, TempRgn, TempRgn);
- PaintRgn(TempRgn);
-
- DisposeRgn(aRgn);
- DisposeRgn(bRgn);
- DisposeRgn(cRgn);
- DisposeRgn(TempRgn);
- END;
-
- {Animate the Shape image using AnimatePalette/CLUT resouces.}
- PROCEDURE AnimShape;
- VAR
- count : INTEGER;
- MyCLUT : ARRAY[1..3] OF CTabHandle;
- BEGIN
- FOR count := 1 TO 3 DO
- MyCLUT[count] := GetCTable(count + 300);
-
- DoDelay(1);
- AnimatePalette(MyWindow[shapeW], MyCLUT[2], 0, 0, 8);
- DoDelay(60);
- AnimatePalette(MyWindow[shapeW], MyCLUT[3], 0, 0, 8);
- DoDelay(60);
- AnimatePalette(MyWindow[shapeW], MyCLUT[1], 0, 0, 8);
- DoDelay(50);
-
- FOR count := 1 TO 5 DO
- BEGIN
- DoDelay(10);
- AnimatePalette(MyWindow[shapeW], MyCLUT[2], 0, 0, 8);
- DoDelay(10);
- AnimatePalette(MyWindow[shapeW], MyCLUT[3], 0, 0, 8);
- DoDelay(10);
- AnimatePalette(MyWindow[shapeW], MyCLUT[1], 0, 0, 8);
- END;
-
- DoDelay(60);
-
- FOR count := 1 TO 5 DO
- BEGIN
- DoDelay(1);
- AnimatePalette(MyWindow[shapeW], MyCLUT[2], 0, 0, 8);
- DoDelay(1);
- AnimatePalette(MyWindow[shapeW], MyCLUT[3], 0, 0, 8);
- DoDelay(1);
- AnimatePalette(MyWindow[shapeW], MyCLUT[1], 0, 0, 8);
- END;
-
- FOR count := 1 TO 3 DO
- DisposCTable(MyCLUT[count]);
- END;
-
- {******************** Rainbow ********************}
-
- {Demonstrates the Rainbow Effect (Rotating Circle,}
- {Moving Bands and Expanding Circle).}
- {}
- {{Create the Rainbow Animation Window.}
- PROCEDURE MakeRainbow;
- VAR
- tempRect : rect;
- tempRGB : RGBColor;
- S : str255;
- tempHSV : HSVColor;
- count : integer;
- BEGIN
- SetRect(tempRect, 50, 160, 590, 400);
- GetIndString(S, StrID, 6);
- MyWindow[rainbowW] := NewCWindow(NIL, tempRect, S, true, noGrowDocProc, POINTER(-1), true, 0);
- MyPalette[rainbowW] := NewPalette(122, NIL, pmAnimated, 0);
-
- SetRGB(tempRGB, $FFFF, $FFFF, $FFFF);
- SetEntryColor(MyPalette[rainbowW], 0, tempRGB);
- SetRGB(tempRGB, 0, 0, 0);
- SetEntryColor(MyPalette[rainbowW], 1, tempRGB);
- tempHSV.saturation := $FFFF;
- tempHSV.value := $FFFF;
- FOR count := 1 TO 120 DO
- BEGIN
- tempHSV.hue := ($0FFFF * count) DIV 120;
- HSV2RGB(tempHSV, tempRGB);
- SetEntryColor(MyPalette[rainbowW], count + 1, tempRGB);
- END;
- SetPalette(MyWindow[rainbowW], MyPalette[rainbowW], true);
- END;
-
- {Draws the rays of the Rainbow.}
- PROCEDURE DoRainbowUpdate;
- VAR
- count : INTEGER;
- tempRect, CRect : Rect;
- BEGIN
- SetRect(tempRect, 0, 0, 480, 240);
- PmForeColor(0);
- PaintRect(tempRect);
- SetRect(tempRect, 0, 0, 240, 240);
- SetRect(CRect, 300, 0, 540, 240);
- FOR count := 0 TO 119 DO
- BEGIN
- PmForeColor(count + 2);
- PaintArc(tempRect, count * 3, 3);
-
- MoveTo(240, count);
- Line(60, 0);
- MoveTo(240, count + 120);
- Line(60, 0);
-
- PaintOval(CRect);
- InsetRect(CRect, 1, 1);
- END;
- END;
-
- {Rotates all the entries in the CLUT one position.}
- PROCEDURE BumpCTEntry (C : CTabHandle);
- VAR
- tempRGB : RGBcolor;
- MyCT : MyCTabHandle;
- count : INTEGER;
- BEGIN
- MyCT := POINTER(C);
- WITH MyCT^^ DO
- BEGIN
- CopyRGB(ctTable[0].rgb, tempRGB);
-
- FOR count := 1 TO ctSize DO
- CopyRGB(ctTable[count].rgb, ctTable[count - 1].rgb);
-
- CopyRGB(tempRGB, ctTable[ctSize].rgb);
- END;
- END;
-
- {Animate the Rainbow using AnimatePalette. This one}
- {creates and manilpulates it's CLUT directly.}
- PROCEDURE AnimRainbow;
- VAR
- count : INTEGER;
- tempRGB : RGBColor;
- tempCT : CTabHandle;
- BEGIN
- tempCT := NewCT(120);
- FOR count := 1 TO 120 DO
- BEGIN
- GetEntryColor(MyPalette[rainbowW], count + 1, tempRGB);
- SetCTEntry(tempCT, count - 1, tempRGB.red, tempRGB.green, tempRGB.blue);
- END;
-
- FOR count := 1 TO 360 DO
- BEGIN
- BumpCTEntry(tempCT);
- DoDelay(1);
- AnimatePalette(MyWindow[rainbowW], tempCT, 0, 2, 120);
- END;
- DisposHandle(Handle(tempCT));
- END;
-
- {******************** Fade ********************}
-
- {Demonstrates the Fade effect}
-
- {Create the Fade Animation Window (uses Palette resource).}
- PROCEDURE MakeFade;
- BEGIN
- MyWindow[fadeW] := GetNewCWindow(FadeID, NIL, POINTER(-1));
- END;
-
- {Draws Fade window}
- PROCEDURE DoFadeUpdate;
- VAR
- tempRect : Rect;
- count : INTEGER;
- BEGIN
- PmForeColor(0);
- SetRect(tempRect, -32000, -32000, 32000, 32000);
- PaintRect(tempRect);
-
- FOR count := 1 TO 4 DO
- BEGIN
- PmForeColor(count);
- SetRect(tempRect, ((count - 1) * 100) + 10, 10, (count * 100) - 10, 90);
- PaintOval(tempRect);
- END;
-
- FOR count := 5 TO 8 DO
- BEGIN
- PmForeColor(count);
- SetRect(tempRect, ((count - 5) * 100) + 10, 110, ((count - 4) * 100) - 10, 190);
- PaintOval(tempRect);
- END;
- END;
-
- {Animate the Fade.}
- PROCEDURE AnimFade;
- CONST
- FadeStep = 60;
- VAR
- count, E : INTEGER;
- Buf, Inc, Start : ARRAY[0..8] OF RGBColor;
- BEGIN
- SetRGB(Buf[0], -1, -1, -1);
- SetRGB(Buf[1], 0, 0, 0);
- SetRGB(Buf[2], -1, 0, 0);
- SetRGB(Buf[3], 0, -1, 0);
- SetRGB(Buf[4], 0, 0, -1);
- SetRGB(Buf[5], 0, -1, -1);
- SetRGB(Buf[6], -1, 0, -1);
- SetRGB(Buf[7], -1, -1, 0);
- SetRGB(Buf[8], 30000, 30000, 30000);
- FOR E := 0 TO 8 DO
- BEGIN
- CopyRGB(Buf[E], Start[E]);
- UnSignedDiv(Buf[E].Red, FadeStep, Inc[E].Red);
- UnSignedDiv(Buf[E].Green, FadeStep, Inc[E].Green);
- UnSignedDiv(Buf[E].Blue, FadeStep, Inc[E].Blue);
- END;
-
- FOR count := FadeStep - 1 DOWNTO 1 DO
- BEGIN
- FOR E := 0 TO 8 DO
- BEGIN
- DoDelay(1);
- UnSignedSub(Buf[E].Red, Inc[E].Red);
- UnSignedSub(Buf[E].Green, Inc[E].Green);
- UnSignedSub(Buf[E].Blue, Inc[E].Blue);
- AnimateEntry(MyWindow[fadeW], E, Buf[E]);
- END;
- END;
-
- DoDelay(1);
- FOR E := 0 TO 8 DO
- BEGIN
- SetRGB(Buf[E], 0, 0, 0);
- AnimateEntry(MyWindow[fadeW], E, Buf[E]);
- END;
-
- DoDelay(90);
-
- FOR count := 1 TO FadeStep - 1 DO
- BEGIN
- FOR E := 0 TO 8 DO
- BEGIN
- DoDelay(1);
- UnSignedAdd(Buf[E].Red, Inc[E].Red);
- UnSignedAdd(Buf[E].Green, Inc[E].Green);
- UnSignedAdd(Buf[E].Blue, Inc[E].Blue);
- AnimateEntry(MyWindow[fadeW], E, Buf[E]);
- END;
- END;
-
- DoDelay(1);
- FOR E := 0 TO 8 DO
- AnimateEntry(MyWindow[fadeW], E, Buf[E]);
- END;
-
-
- END.